package cn.wolfcode.luowowo.article.query;

import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class TravelQuery extends QueryObject{

    private Long destId = -1L;     //设置默认
    private int perExpendType = -1;  //人均消费
    private int travelTimeType = -1;    //旅游时间private int dayType = -1;
    // 旅游天数
    private int dayType = -1;
    private int orderType = 1;  //排序 默认是最新
    //设置最新还是最热
    public String getOrderBy(){
        return orderType==2 ? "t.viewnum desc" : "t.createTime desc";
    }

    //将页面传入key值转换成范围对象
    public TravelCondition getPerExpend(){
        return TravelCondition.TRAVEL_PER_EXPEND.get(perExpendType);
    }

    //获取旅游天数
    public TravelCondition getDay(){
        return TravelCondition.TRAVEL_DAYS.get(dayType);
    }

    //获取出发时间
    public TravelCondition getTravelTime(){
        return TravelCondition.TRAVEL_TIME.get(travelTimeType);
    }
}
